<?php

class interesses{
	
	var $id;
	var $titulo;
	
	

	function pega(){
	$sql = mysql_query("select * from interesses WHERE id = '".$this->id."'");
	
	
	$row = mysql_fetch_array($sql);
	$lista = array(
	id		=>$row['id'],
	titulo	=>$row['titulo']
	);
	
	
	return $lista;
	
	}




	function lista($where,$order,$limit){
	$sql = mysql_query("select * from interesses $where $order $limit");
	
	$x=0;
	while($row = mysql_fetch_array($sql)){
	$x++;
	
	$lista[$x] = array(

	id		=>$row['id'],
	titulo	=>$row['titulo']
	);
	
	}	
	
	return $lista;
	
	}
	
	
	function cadastra(){
	$sql= mysql_query("insert into interesses values(
	'0',
	'".$this->titulo."'
	)");	
	
	if($sql == true){
	return true;
	}else{
	return false;
	}
	}
	
	
	
	function edita(){
	$sql= mysql_query("UPDATE interesses SET 
	titulo 		= '".$this->titulo."'
	WHERE id = '".$this->id."'
	");	
	
	if($sql == true){
	return true;
	}else{
	return false;
	}
	}
	
	
	
	function deleta(){
	$sql= mysql_query("DELETE FROM interesses WHERE id = '".$this->id."'");	
	if($sql == true){
	return true;
		}else{
	return false;
		}
	}
	
	
	
	
	}


?>